<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
	<%@include file="common/base.jsp" %>
<!DOCTYPE html>
<html class="login-bg">
<head>
	<title>后台登录</title>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	
    <!-- bootstrap -->
    <link href="${path }/dist/css/bootstrap.css" rel="stylesheet">
    <link href="${path }/dist/css/bootstrap-overrides.css" type="text/css" rel="stylesheet">

    <!-- global styles -->
    <link rel="stylesheet" type="text/css" href="${path }/dist/css/compiled/layout.css">
    <link rel="stylesheet" type="text/css" href="${path }/dist/css/compiled/elements.css">

    <!-- libraries -->
    <link rel="stylesheet" type="text/css" href="${path }/dist/css/font-awesome.css">
    
    <!-- this page specific styles -->
    <link rel="stylesheet" href="${path }/dist/css/compiled/signin.css" type="text/css" media="screen" />

    <!--[if lt IE 9]>
      <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->
    	<script src="${path }/dist/js/jquery.min.js"></script>
	<script src="${path }/dist/js/bootstrap.min.js"></script>
	<script src="${path }/dist/js/cookie.js"></script>
	<script src="${path }/dist/js/getmd5.js"></script>
</head>
<body>
    <div class="bg-switch visible-desktop">
        <div class="bgs">
            <a href="#" data-img="landscape.jpg" class="bg active">
                <img src="${path }/dist/img/bgs/landscape.jpg" />
            </a>
            <a href="#" data-img="blueish.jpg" class="bg">
                <img src="${path }/dist/img/bgs/blueish.jpg" />
            </a>            
            <a href="#" data-img="7.jpg" class="bg">
                <img src="${path }/dist/img/bgs/7.jpg" />
            </a>
            <a href="#" data-img="8.jpg" class="bg">
                <img src="${path }/dist/img/bgs/8.jpg" />
            </a>
            <a href="#" data-img="9.jpg" class="bg">
                <img src="${path }/dist/img/bgs/9.jpg" />
            </a>
            <a href="#" data-img="10.jpg" class="bg">
                <img src="${path }/dist/img/bgs/10.jpg" />
            </a>
            <a href="#" data-img="11.jpg" class="bg">
                <img src="${path }/dist/img/bgs/11.jpg" />
            </a>
        </div>
    </div>
    <div class="login-wrapper">
        	<h3 class="text-info">欢迎登录XX资产管理 </h3>
        <div class="box" style="margin-top: 10px;">
            <div class="content-wrap">
                <h6>登录</h6>
                <form id="loginback" method="post">
                <input class="form-control" type="text" placeholder="邮箱地址" name="user.user_account">
                <input class="form-control" type="password" placeholder="密码" name="user_pass">
                <a href="#" class="forgot">忘记密码?</a>
                <div class="remember">
                    <input id="remember" type="checkbox" name="remember">
                    
                    <label for="remember">记住密码</label>
                </div>
                </form>
                <a class="btn-glow primary login" href="#" id="signin">登录</a>
                <a class="btn-glow primary login" href="#">返回</a>
                
            </div>
        </div>


    <!-- pre load bg imgs -->
    <script type="text/javascript">
        $(function () {
        	if(window.parent.location.href!=window.location.href){
    			top.location.href=window.location.href;
    		}
        	if(getCookie("cb")=="true"){
				document.getElementById('remember').checked=true;
				$("#loginback input[name='user.user_account']").val(getCookie("user_account"));
				$("#loginback input[name='user_pass']").val(getCookie("pass"));
			}
        	 // bg switcher
            var $btns = $(".bg-switch .bg");
            $btns.click(function (e) {
                e.preventDefault();
                $btns.removeClass("active");
                $(this).addClass("active");
                var bg = $(this).data("img");

                $("html").css("background-image", "url('${path }/dist/img/bgs/" + bg + "')");
            });
            $("#remember").on("change",function(){
            	//alert($("#remember").is(':checked'));
            	setCookie("cb",document.getElementById('remember').checked,60*60*24);
            	//alert(document.cookie);
            });
            $("#signin").on("click",function(e){
            	// 登录验证
            	if($("#loginback input[name='user.user_account']").val()==""||$("#loginback input[name='user.user_account']").val().length<=0){
    				alert("用户名不可为空");
    				$("#loginback input[name='user.user_account']").focus();
    				return;
    			}else if($("#loginback input[name='user_pass']").val()==""||$("#loginback input[name='user_pass']").val().length<=0){
    				alert("密码不可为空");
    				$("#loginback input[name='user_pass']").focus();
    				return;
    			}
    	    	var pass=$("#loginback  input[name='user_pass']").val();
    	    	
    			var t=$('#loginback').serializeArray();
    			t.push({name:"user.user_pass",value:hex_md5(pass)})
    			var submitURL = "${path}/hello!signin?date="+new Date()+"";
    			jQuery.post(submitURL,t,function(jsonData){
    				if(jsonData.info){
    					if(document.getElementById('remember').checked==true){
    						setCookie('user_account',$("#loginback input[name='user.user_account']").val(),60*60*24);
    						setCookie('pass',pass,60*60*24);
    					}
    					window.location.replace("${path}/back/ms!index");
    				}else{
    					alert(jsonData.text);
    					$("#signmodel input[name='user.user_account']").focus();
    				}
    			},"json");
            })
        });

    </script>
</body>
</html>